<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>RT-Thread RTOS: Clock and Timer Management</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">RT-Thread RTOS
   &#160;<span id="projectnumber">1.2.0</span>
   </div>
   <div id="projectbrief">An open source embedded real-time operating system</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group___clock.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Clock and Timer Management<div class="ingroups"><a class="el" href="group___kernel.html">RT-Thread Kernel API</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrt__timer.html">rt_timer</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:gaf00c192dcbc7a949beebaec8e8bf9232"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#gaf00c192dcbc7a949beebaec8e8bf9232">RT_TIMER_FLAG_DEACTIVATED</a>&#160;&#160;&#160;0x0</td></tr>
<tr class="separator:gaf00c192dcbc7a949beebaec8e8bf9232"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga174b5f60b760b5e421616ff17cb15c4b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga174b5f60b760b5e421616ff17cb15c4b">RT_TIMER_FLAG_ACTIVATED</a>&#160;&#160;&#160;0x1</td></tr>
<tr class="separator:ga174b5f60b760b5e421616ff17cb15c4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae9ef5d12543ac6b2113741ed503fc9c3"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#gae9ef5d12543ac6b2113741ed503fc9c3">RT_TIMER_FLAG_ONE_SHOT</a>&#160;&#160;&#160;0x0</td></tr>
<tr class="separator:gae9ef5d12543ac6b2113741ed503fc9c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga52a9fd903938762a98408771bd139097"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga52a9fd903938762a98408771bd139097">RT_TIMER_FLAG_PERIODIC</a>&#160;&#160;&#160;0x2</td></tr>
<tr class="separator:ga52a9fd903938762a98408771bd139097"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad750e1e3947c267e57be487dad3b4300"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#gad750e1e3947c267e57be487dad3b4300">RT_TIMER_FLAG_HARD_TIMER</a>&#160;&#160;&#160;0x0</td></tr>
<tr class="separator:gad750e1e3947c267e57be487dad3b4300"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0df6e547917d460610fd734ae84daca3"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga0df6e547917d460610fd734ae84daca3">RT_TIMER_FLAG_SOFT_TIMER</a>&#160;&#160;&#160;0x4</td></tr>
<tr class="separator:ga0df6e547917d460610fd734ae84daca3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9b1d12b8471acff4c8f9eebb4216c7df"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga9b1d12b8471acff4c8f9eebb4216c7df">RT_TIMER_CTRL_SET_TIME</a>&#160;&#160;&#160;0x0</td></tr>
<tr class="separator:ga9b1d12b8471acff4c8f9eebb4216c7df"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2bbc0b4b2a4914c8eea4d1263e52ab85"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga2bbc0b4b2a4914c8eea4d1263e52ab85">RT_TIMER_CTRL_GET_TIME</a>&#160;&#160;&#160;0x1</td></tr>
<tr class="separator:ga2bbc0b4b2a4914c8eea4d1263e52ab85"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga460a57e7d4fe4ea24772affaca3d62bc"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga460a57e7d4fe4ea24772affaca3d62bc">RT_TIMER_CTRL_SET_ONESHOT</a>&#160;&#160;&#160;0x2</td></tr>
<tr class="separator:ga460a57e7d4fe4ea24772affaca3d62bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2e125a6714e6a5ff5756129cadbe3a7d"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga2e125a6714e6a5ff5756129cadbe3a7d">RT_TIMER_CTRL_SET_PERIODIC</a>&#160;&#160;&#160;0x3</td></tr>
<tr class="separator:ga2e125a6714e6a5ff5756129cadbe3a7d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga6e2aa36f263bddcddae01a91986fcdae"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___basic_def.html#ga66c400929925784dba020d671154978a">rt_tick_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga6e2aa36f263bddcddae01a91986fcdae">rt_tick_get</a> (void)</td></tr>
<tr class="separator:ga6e2aa36f263bddcddae01a91986fcdae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga77af135da16a0b9e1c4a351f4bee6dbd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga77af135da16a0b9e1c4a351f4bee6dbd">rt_tick_set</a> (<a class="el" href="group___basic_def.html#ga66c400929925784dba020d671154978a">rt_tick_t</a> tick)</td></tr>
<tr class="separator:ga77af135da16a0b9e1c4a351f4bee6dbd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga29337f93377626f651dd393e1bb608fb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga29337f93377626f651dd393e1bb608fb">rt_tick_increase</a> (void)</td></tr>
<tr class="separator:ga29337f93377626f651dd393e1bb608fb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf9f1453af745c5feeb9a7f7f065f025b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___basic_def.html#ga66c400929925784dba020d671154978a">rt_tick_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#gaf9f1453af745c5feeb9a7f7f065f025b">rt_tick_from_millisecond</a> (<a class="el" href="group___basic_def.html#ga909edcac80e5e3f93f63fcebc95922c7">rt_uint32_t</a> ms)</td></tr>
<tr class="separator:gaf9f1453af745c5feeb9a7f7f065f025b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga678d29f53307113da6b1578c9d3423cb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga678d29f53307113da6b1578c9d3423cb">rt_timer_init</a> (<a class="el" href="structrt__timer.html">rt_timer_t</a> timer, const char *name, void(*timeout)(void *parameter), void *parameter, <a class="el" href="group___basic_def.html#ga66c400929925784dba020d671154978a">rt_tick_t</a> time, <a class="el" href="group___basic_def.html#ga585e2ad0fbab0f83817cb61373465df6">rt_uint8_t</a> flag)</td></tr>
<tr class="separator:ga678d29f53307113da6b1578c9d3423cb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0d1aca4fc86f1dbd88945be8820793bb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___basic_def.html#ga42df42aabf676f2a89f5af2208b79950">rt_err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga0d1aca4fc86f1dbd88945be8820793bb">rt_timer_detach</a> (<a class="el" href="structrt__timer.html">rt_timer_t</a> timer)</td></tr>
<tr class="separator:ga0d1aca4fc86f1dbd88945be8820793bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9e6911989135de1b989dd7fe1b3543ce"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structrt__timer.html">rt_timer_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga9e6911989135de1b989dd7fe1b3543ce">rt_timer_create</a> (const char *name, void(*timeout)(void *parameter), void *parameter, <a class="el" href="group___basic_def.html#ga66c400929925784dba020d671154978a">rt_tick_t</a> time, <a class="el" href="group___basic_def.html#ga585e2ad0fbab0f83817cb61373465df6">rt_uint8_t</a> flag)</td></tr>
<tr class="separator:ga9e6911989135de1b989dd7fe1b3543ce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf6c147a1f25bd5ac9e72a142ab36a4ac"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___basic_def.html#ga42df42aabf676f2a89f5af2208b79950">rt_err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#gaf6c147a1f25bd5ac9e72a142ab36a4ac">rt_timer_delete</a> (<a class="el" href="structrt__timer.html">rt_timer_t</a> timer)</td></tr>
<tr class="separator:gaf6c147a1f25bd5ac9e72a142ab36a4ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3aeb8f8350b3a7403d8629231396c016"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___basic_def.html#ga42df42aabf676f2a89f5af2208b79950">rt_err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga3aeb8f8350b3a7403d8629231396c016">rt_timer_start</a> (<a class="el" href="structrt__timer.html">rt_timer_t</a> timer)</td></tr>
<tr class="separator:ga3aeb8f8350b3a7403d8629231396c016"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaaef9923c8b90ede02e12826c58c6f8a2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___basic_def.html#ga42df42aabf676f2a89f5af2208b79950">rt_err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#gaaef9923c8b90ede02e12826c58c6f8a2">rt_timer_stop</a> (<a class="el" href="structrt__timer.html">rt_timer_t</a> timer)</td></tr>
<tr class="separator:gaaef9923c8b90ede02e12826c58c6f8a2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4f59e029dbca9de4db8821a45a0aaf53"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___basic_def.html#ga42df42aabf676f2a89f5af2208b79950">rt_err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga4f59e029dbca9de4db8821a45a0aaf53">rt_timer_control</a> (<a class="el" href="structrt__timer.html">rt_timer_t</a> timer, <a class="el" href="group___basic_def.html#ga585e2ad0fbab0f83817cb61373465df6">rt_uint8_t</a> cmd, void *arg)</td></tr>
<tr class="separator:ga4f59e029dbca9de4db8821a45a0aaf53"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3a29a70b401aa9d5c5dbb7269fd0ac57"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga3a29a70b401aa9d5c5dbb7269fd0ac57">rt_timer_check</a> (void)</td></tr>
<tr class="separator:ga3a29a70b401aa9d5c5dbb7269fd0ac57"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga51af0ff7d55ff298adfb87d276d0d678"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___basic_def.html#ga66c400929925784dba020d671154978a">rt_tick_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga51af0ff7d55ff298adfb87d276d0d678">rt_timer_next_timeout_tick</a> (void)</td></tr>
<tr class="separator:ga51af0ff7d55ff298adfb87d276d0d678"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae62f4fc2660b4b42ec0504ea971315bf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#gae62f4fc2660b4b42ec0504ea971315bf">rt_system_tick_init</a> (void)</td></tr>
<tr class="separator:gae62f4fc2660b4b42ec0504ea971315bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9f109e873cdcf963059e968cedb76c36"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#ga9f109e873cdcf963059e968cedb76c36">rt_system_timer_init</a> (void)</td></tr>
<tr class="separator:ga9f109e873cdcf963059e968cedb76c36"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac5298e02b109e4885723f6116fb11814"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#gac5298e02b109e4885723f6116fb11814">rt_system_timer_thread_init</a> (void)</td></tr>
<tr class="separator:gac5298e02b109e4885723f6116fb11814"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf048118e9baee3eb9933a19a0ab80f69"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___clock.html#gaf048118e9baee3eb9933a19a0ab80f69">rt_timer_timeout_sethook</a> (void(*hook)(struct <a class="el" href="structrt__timer.html">rt_timer</a> *timer))</td></tr>
<tr class="separator:gaf048118e9baee3eb9933a19a0ab80f69"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>*RT-Thread uses clock tick to implement shared time-slice scheduling.</p>
<p>The timing sensitivity of thread is implemented by timers. The timer can be set as one-shot or periodic timeout. </p>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="gaf00c192dcbc7a949beebaec8e8bf9232"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RT_TIMER_FLAG_DEACTIVATED&#160;&#160;&#160;0x0</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>clock &amp; timer macrostimer is deactive </p>

</div>
</div>
<a class="anchor" id="ga174b5f60b760b5e421616ff17cb15c4b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RT_TIMER_FLAG_ACTIVATED&#160;&#160;&#160;0x1</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>timer is active </p>

</div>
</div>
<a class="anchor" id="gae9ef5d12543ac6b2113741ed503fc9c3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RT_TIMER_FLAG_ONE_SHOT&#160;&#160;&#160;0x0</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>one shot timer </p>

</div>
</div>
<a class="anchor" id="ga52a9fd903938762a98408771bd139097"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RT_TIMER_FLAG_PERIODIC&#160;&#160;&#160;0x2</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>periodic timer </p>

</div>
</div>
<a class="anchor" id="gad750e1e3947c267e57be487dad3b4300"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RT_TIMER_FLAG_HARD_TIMER&#160;&#160;&#160;0x0</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>hard timer,the timer's callback function will be called in tick isr. </p>

</div>
</div>
<a class="anchor" id="ga0df6e547917d460610fd734ae84daca3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RT_TIMER_FLAG_SOFT_TIMER&#160;&#160;&#160;0x4</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>soft timer,the timer's callback function will be called in timer thread. </p>

</div>
</div>
<a class="anchor" id="ga9b1d12b8471acff4c8f9eebb4216c7df"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RT_TIMER_CTRL_SET_TIME&#160;&#160;&#160;0x0</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>set timer control command </p>

</div>
</div>
<a class="anchor" id="ga2bbc0b4b2a4914c8eea4d1263e52ab85"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RT_TIMER_CTRL_GET_TIME&#160;&#160;&#160;0x1</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>get timer control command </p>

</div>
</div>
<a class="anchor" id="ga460a57e7d4fe4ea24772affaca3d62bc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RT_TIMER_CTRL_SET_ONESHOT&#160;&#160;&#160;0x2</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>change timer to one shot </p>

</div>
</div>
<a class="anchor" id="ga2e125a6714e6a5ff5756129cadbe3a7d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RT_TIMER_CTRL_SET_PERIODIC&#160;&#160;&#160;0x3</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>change timer to periodic </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga6e2aa36f263bddcddae01a91986fcdae"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___basic_def.html#ga66c400929925784dba020d671154978a">rt_tick_t</a> rt_tick_get </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will return current tick from operating system startup</p>
<dl class="section return"><dt>Returns</dt><dd>current tick </dd></dl>

</div>
</div>
<a class="anchor" id="ga77af135da16a0b9e1c4a351f4bee6dbd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rt_tick_set </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___basic_def.html#ga66c400929925784dba020d671154978a">rt_tick_t</a>&#160;</td>
          <td class="paramname"><em>tick</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will set current tick </p>

</div>
</div>
<a class="anchor" id="ga29337f93377626f651dd393e1bb608fb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rt_tick_increase </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will notify kernel there is one tick passed. Normally, this function is invoked by clock ISR. </p>

</div>
</div>
<a class="anchor" id="gaf9f1453af745c5feeb9a7f7f065f025b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___basic_def.html#ga66c400929925784dba020d671154978a">rt_tick_t</a> rt_tick_from_millisecond </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___basic_def.html#ga909edcac80e5e3f93f63fcebc95922c7">rt_uint32_t</a>&#160;</td>
          <td class="paramname"><em>ms</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will calculate the tick from millisecond.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ms</td><td>the specified millisecond</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the calculated tick </dd></dl>

</div>
</div>
<a class="anchor" id="ga678d29f53307113da6b1578c9d3423cb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rt_timer_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structrt__timer.html">rt_timer_t</a>&#160;</td>
          <td class="paramname"><em>timer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*)(void *parameter)&#160;</td>
          <td class="paramname"><em>timeout</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>parameter</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group___basic_def.html#ga66c400929925784dba020d671154978a">rt_tick_t</a>&#160;</td>
          <td class="paramname"><em>time</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group___basic_def.html#ga585e2ad0fbab0f83817cb61373465df6">rt_uint8_t</a>&#160;</td>
          <td class="paramname"><em>flag</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will initialize a timer, normally this function is used to initialize a static timer object.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">timer</td><td>the static timer object </td></tr>
    <tr><td class="paramname">name</td><td>the name of timer </td></tr>
    <tr><td class="paramname">timeout</td><td>the timeout function </td></tr>
    <tr><td class="paramname">parameter</td><td>the parameter of timeout function </td></tr>
    <tr><td class="paramname">time</td><td>the tick of timer </td></tr>
    <tr><td class="paramname">flag</td><td>the flag of timer </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga0d1aca4fc86f1dbd88945be8820793bb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___basic_def.html#ga42df42aabf676f2a89f5af2208b79950">rt_err_t</a> rt_timer_detach </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structrt__timer.html">rt_timer_t</a>&#160;</td>
          <td class="paramname"><em>timer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will detach a timer from timer management.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">timer</td><td>the static timer object</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the operation status, RT_EOK on OK; RT_ERROR on error </dd></dl>

</div>
</div>
<a class="anchor" id="ga9e6911989135de1b989dd7fe1b3543ce"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structrt__timer.html">rt_timer_t</a> rt_timer_create </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*)(void *parameter)&#160;</td>
          <td class="paramname"><em>timeout</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>parameter</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group___basic_def.html#ga66c400929925784dba020d671154978a">rt_tick_t</a>&#160;</td>
          <td class="paramname"><em>time</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group___basic_def.html#ga585e2ad0fbab0f83817cb61373465df6">rt_uint8_t</a>&#160;</td>
          <td class="paramname"><em>flag</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will create a timer</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>the name of timer </td></tr>
    <tr><td class="paramname">timeout</td><td>the timeout function </td></tr>
    <tr><td class="paramname">parameter</td><td>the parameter of timeout function </td></tr>
    <tr><td class="paramname">time</td><td>the tick of timer </td></tr>
    <tr><td class="paramname">flag</td><td>the flag of timer</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the created timer object </dd></dl>

</div>
</div>
<a class="anchor" id="gaf6c147a1f25bd5ac9e72a142ab36a4ac"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___basic_def.html#ga42df42aabf676f2a89f5af2208b79950">rt_err_t</a> rt_timer_delete </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structrt__timer.html">rt_timer_t</a>&#160;</td>
          <td class="paramname"><em>timer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will delete a timer and release timer memory</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">timer</td><td>the timer to be deleted</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the operation status, RT_EOK on OK; RT_ERROR on error </dd></dl>

</div>
</div>
<a class="anchor" id="ga3aeb8f8350b3a7403d8629231396c016"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___basic_def.html#ga42df42aabf676f2a89f5af2208b79950">rt_err_t</a> rt_timer_start </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structrt__timer.html">rt_timer_t</a>&#160;</td>
          <td class="paramname"><em>timer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will start the timer</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">timer</td><td>the timer to be started</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the operation status, RT_EOK on OK, -RT_ERROR on error </dd></dl>

</div>
</div>
<a class="anchor" id="gaaef9923c8b90ede02e12826c58c6f8a2"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___basic_def.html#ga42df42aabf676f2a89f5af2208b79950">rt_err_t</a> rt_timer_stop </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structrt__timer.html">rt_timer_t</a>&#160;</td>
          <td class="paramname"><em>timer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will stop the timer</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">timer</td><td>the timer to be stopped</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the operation status, RT_EOK on OK, -RT_ERROR on error </dd></dl>

</div>
</div>
<a class="anchor" id="ga4f59e029dbca9de4db8821a45a0aaf53"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___basic_def.html#ga42df42aabf676f2a89f5af2208b79950">rt_err_t</a> rt_timer_control </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structrt__timer.html">rt_timer_t</a>&#160;</td>
          <td class="paramname"><em>timer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group___basic_def.html#ga585e2ad0fbab0f83817cb61373465df6">rt_uint8_t</a>&#160;</td>
          <td class="paramname"><em>cmd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>arg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will get or set some options of the timer</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">timer</td><td>the timer to be get or set </td></tr>
    <tr><td class="paramname">cmd</td><td>the control command </td></tr>
    <tr><td class="paramname">arg</td><td>the argument</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>RT_EOK </dd></dl>

</div>
</div>
<a class="anchor" id="ga3a29a70b401aa9d5c5dbb7269fd0ac57"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rt_timer_check </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will check timer list, if a timeout event happens, the corresponding timeout function will be invoked.</p>
<dl class="section note"><dt>Note</dt><dd>this function shall be invoked in operating system timer interrupt. </dd></dl>

</div>
</div>
<a class="anchor" id="ga51af0ff7d55ff298adfb87d276d0d678"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___basic_def.html#ga66c400929925784dba020d671154978a">rt_tick_t</a> rt_timer_next_timeout_tick </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will return the next timeout tick in the system.</p>
<dl class="section return"><dt>Returns</dt><dd>the next timeout tick in the system </dd></dl>

</div>
</div>
<a class="anchor" id="gae62f4fc2660b4b42ec0504ea971315bf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rt_system_tick_init </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will init system tick and set it to zero.</p>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000001">Deprecated:</a></b></dt><dd>since 1.1.0, this function does not need to be invoked in the system initialization. </dd></dl>

</div>
</div>
<a class="anchor" id="ga9f109e873cdcf963059e968cedb76c36"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rt_system_timer_init </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will initialize system timer </p>

</div>
</div>
<a class="anchor" id="gac5298e02b109e4885723f6116fb11814"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rt_system_timer_thread_init </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will initialize system timer thread </p>

</div>
</div>
<a class="anchor" id="gaf048118e9baee3eb9933a19a0ab80f69"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rt_timer_timeout_sethook </td>
          <td>(</td>
          <td class="paramtype">void(*)(struct <a class="el" href="structrt__timer.html">rt_timer</a> *timer)&#160;</td>
          <td class="paramname"><em>hook</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will set a hook function, which will be invoked when timer is timeout.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">hook</td><td>the hook function </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Mon Jan 6 2014 23:05:02 for RT-Thread RTOS by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li>
  </ul>
</div>
</body>
</html>
